set(srcs remove_nested_block.cc replace_call_with_expr.cc ir_copy.cc
  ir_replace.cc
  replace_var_with_expr.cc
  tensor_write_tell.cc
  ir_simplify.cc
  optimize.cc
  vectorize_loops.cc
  unroll_loops.cc
  transform_polyfor_to_for.cc
  eliminate_broadcast_in_forloop.cc
  fold_cinn_call_arguments.cc
  call_arg_list_to_pod_value.cc
  insert_debug_log_callee.cc
  lower_function_call_bind_vars.cc
  extern_call_process.cc
        map_extern_call.cc
  cache_read_write_replace.cc
  compute_inline_expand.cc
  buffer_assign.cc
  )
if (WITH_CUDA)
  list(APPEND srcs transform_gpu_forloop.cc)
endif()

foreach(cpp ${srcs})
  set(core_src
      "${core_src};cinn/optim/${cpp}"
      CACHE INTERNAL "")
endforeach()

cc_test(test_remove_nested_block SRCS remove_nested_block_test.cc DEPS core)
cc_test(test_ir_copy SRCS ir_copy_test.cc DEPS core)
cc_test(test_ir_simplify SRCS ir_simplify_test.cc DEPS core)
cc_test(test_replace_call_with_expr SRCS replace_call_with_expr_test.cc DEPS core)
cc_test(test_vectorize_loops SRCS vectorize_loops_test.cc DEPS core ARGS ${global_test_args})
cc_test(test_transform_polyfor_to_for SRCS transform_polyfor_to_for_test.cc DEPS core ARGS ${global_test_args})
cc_test(test_optimize SRCS optimize_test.cc DEPS core)
cc_test(test_cache_read_write_replace SRCS cache_read_write_replace_test.cc DEPS core)
if (WITH_CUDA)
  cc_test(test_transform_gpu_forloop SRCS transform_gpu_forloop_test.cc DEPS core)
endif()
